package com.iweb.common.result;

/**
 * 状态码、状态信息枚举
 */
public enum ResultCode {

    SUCCESS(2000, "执行成功"),
    ARG_EXCEPT(3000, "请求参数异常"),
    TOKEN_EXCEPT(3001, "授权异常"),
    FAIL(4000, "业务失败"),
    FAIL_LOGIN_USERNAME(4001, "用户名不正确"),
    FAIL_LOGIN_PASSWORD(4002, "密码不正确"),
    FAIL_REG_USER(4003, "用户已注册"),
    SYS(5000, "系统异常");

    private Integer code;
    private String message;

    ResultCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer code() {
        return this.code;
    }

    public String message() {
        return message;
    }

    public static ResultCode SYS_ERROR(String message) {
        ResultCode resultCode = ResultCode.SYS;
        resultCode.message = message;
        return resultCode;
    }
}
